import functools

# def now():
#     print('2020-1-31')

# f = now
# f()

# print(now.__name__)
# print(f.__name__)

# 不带参数
# def log(func):
#     def wrapper(*args, **kw):
#         print('call %s():' % func.__name__)
#         return func(*args, **kw)
#     return wrapper

# 带参数
def log(text):
    def decorator(func):
        @functools.wraps(func)
        def wrapper(*args, **kw):
            print('%s %s():' % (text, func.__name__))
            return func(*args, **kw)
        return wrapper
    return decorator

@log('execute')
def now():
    print('2020-1-31')

# now()
print(now.__name__)